<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@page import="bit.util.ConnectionContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="reqCharEnc.jsp" %>
<%@ include file="preventCache.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>회원 등록 처리</title>
<link rel="stylesheet"
	type="text/css"
	href="<%= application.getContextPath() %>/style/main.css" />
</head>
<body>

<%
// parameters
String loginId = request.getParameter("loginId");
String name = request.getParameter("name");
String email = request.getParameter("email");
String telNo = request.getParameter("telNo");

// Connection
Connection conn = ConnectionContext.getConnection();
// SQL Query
String sql = "INSERT INTO member_info (login_id, name, email, tel_no) "
			+ "VALUES (?, ?, ?, ?)";
// prepare statement
PreparedStatement pstmt = conn.prepareStatement(sql);

pstmt.setString(1, loginId);
pstmt.setString(2, name);
pstmt.setString(3, email);
pstmt.setString(4, telNo);

// execute
int result = pstmt.executeUpdate();

if (result > 0) {
%>
	회원 등록에 성공하였습니다.
<%
} else {
%>
	회원 등록에 실패하였습니다.
<%
}
%>
<br/><br/>
<input type="button" value="회원 목록으로 돌아가기" onclick="location.href='members.jsp';" />

</body>
</html>